package com.keeley.spider.model;

import com.jfinal.plugin.activerecord.Model;

/**
 * Created with IntelliJ IDEA.
 * User: Tianjun
 * Date: 14-9-15
 * Time: 上午9:38
 * To change this template use File | Settings | File Templates.
 */
public class Apk extends Model<Apk> {
    public final static Apk dao = new Apk();


    public Apk getApk(String signature,String app_package,String version_code ){
        String sql="select p.* from p_apk p inner join p_appbase pa " +
                "on p.paid=pa.id " +
                "where p.signature =? " +
                "and pa.app_package=? " +
                "and p.app_status=1 and pa.status=1 " +
                //"and pa.source =1 and pa.scid ='73C753CB-0549-43CA-8C4F-187685C24DAA' and (pa.isProfit is null or pa.isProfit =0)" +
                "and convert(int,p.package_version_code)  < convert(int,?) ";
        return dao.findFirst(sql,signature,app_package,version_code);
    }
}
